import pandas as pd
date_index =pd.to_datetime(['20230110','20230115','20230118'])
date_ser =pd.Series([11,22,33],index=date_index)
date_ser
print(date_ser)

from datetime import datetime
import pandas as pd

data_demo = [[11,22,33],[44,55,66],
             [77,88,99],[12,23,34]]
date_list = [datetime(1999,4,21),datetime(2006,11,21),datetime(2025,11,15),datetime(2025,11,16)]
time_df = pd.DataFrame(data_demo,index=date_list)
print(time_df)

import pandas as pd
import numpy as np
date_list = ['2020/05/30', '2022/02/01', '2020/6/1',
             '2021/4/1', '2022/6/1', '2023/1/23']
# 根据日期字符串生成DatetimeIndex类的对象
date_index = pd.to_datetime(date_list)
# 创建Series类的对象，并指定索引是DatetimeIndex
date_ser = pd.Series(np.arange(6), index=date_index)
date_ser
print(date_ser)

